package com.ruoyi.travel.service.impl;

import com.ruoyi.travel.domain.TravelItineraryContent;
import com.ruoyi.travel.mapper.TravelItineraryContentMapper;
import com.ruoyi.travel.service.ITravelItineraryContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

@Service
public class TravelItineraryContentServiceImpl implements ITravelItineraryContentService {

    @Autowired
    private TravelItineraryContentMapper contentMapper;

    @Override
    public List<TravelItineraryContent> selectByItineraryId(Long itineraryId) {
        return contentMapper.selectByItineraryId(itineraryId);
    }

    @Override
    public int insertTravelItineraryContent(TravelItineraryContent content) {
        return contentMapper.insertTravelItineraryContent(content);
    }

    @Override
    @Transactional
    public int batchInsert(List<TravelItineraryContent> contents) {
        if (contents == null || contents.isEmpty()) {
            return 0;
        }
        return contentMapper.batchInsert(contents);
    }

    @Override
    @Transactional
    public int deleteByItineraryId(Long itineraryId) {
        return contentMapper.deleteByItineraryId(itineraryId);
    }
}
